/*
 * @lc app=leetcode.cn id=1128 lang=typescript
 *
 * [1128] 等价多米诺骨牌对的数量
 */

// @lc code=start
function numEquivDominoPairs(dominoes: number[][]): number {
    const isEqual = ([x0, y0]: number[], [x1, y1]: number[]) => {
        return (x0 === x1 && y0 === y1) || (x0 === y1 && y0 === x1);
    };
    let count = 0;
    for (let i = 0; i < dominoes.length; i++) {
        const element = dominoes[i];
        for (let j = i + 1; j < dominoes.length; j++) {
            const el = dominoes[j];
            isEqual(element, el) && count++;
        }
    }
    return count;
}
// @lc code=end
